package mao.thinkinjava.io;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class TestFileWriter {

    public static void main(String[] args) throws IOException {
        FileWriter writer;
        writer = new FileWriter("mm");
        PrintWriter printWriter = new PrintWriter(writer);
        printWriter.println("test");
        writer.close();//注意要刷新，否则可能没有写入文件。

        PrintWriter testPrintWriter = new PrintWriter("testPrintWriter");
        testPrintWriter.println("PrintWriter(\"String filePath\")");
        testPrintWriter.close();
    }
}
